package com.sunda.spmscommon.utils;

import com.github.pagehelper.PageInfo;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @program: spms
 * @description: data to page
 * @author: Wayne Wu
 * @create: 2021-04-08 15:58
 **/

public class DataToPage {
    public Map<String,Object> toPageData(List<Map<String, Object>> mapList){
        PageInfo<Map<String, Object>> pageData = new PageInfo<>(mapList);
        Map<String,Object> pageInfo = new HashMap<>();
        pageInfo.put("records", pageData.getList());
        pageInfo.put("total", pageData.getTotal());
        pageInfo.put("size", pageData.getSize());
        pageInfo.put("current", pageData.getPageNum());
        pageInfo.put("pages", pageData.getPages());
        return pageInfo;
    }
}
